home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 21.zip / BS1 part 21 / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].7z / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].adf / rexx.lzh / MakeGuides.pprx < prev    next >
Text File  |  1992-03-13  |  2KB  |  113 lines

  1. /*
  2. @BMakeGuides  @P@ICopyright Gold Disk Inc., January, 1992
  3. This Genie makes a grid of boxes to help layout symmetry.
  4. */
  5. address command
  6. call SafeEndEdit.rexx()
  7. call ppm_AutoUpdate(0)
  8. cr  = '0a'x
  9.  
  10. units = ppm_GetUnits()
  11. if units = 3 then
  12.     call ppm_SetUnits(1)
  13.  
  14. signal on halt
  15. signal on break_c
  16. signal on break_e
  17. signal on break_d
  18. form    = "Columns"cr"Rows"cr"Gutter"
  19. form    = ppm_GetForm("Enter Dimensions of Grid", 8, form)
  20. if form = '' then exit_msg()
  21. parse var form columns '0a'x rows '0a'x gutter
  22.  
  23. if  columns = '' then columns   = 1
  24. if  rows    = '' then rows  = 1
  25. if  gutter  = '' then gutter    = 0
  26.  
  27. if ~(datatype(columns, n) & datatype(rows, n) & datatype(gutter, n)) then
  28.     exit_msg("Invalid entry")
  29.  
  30. if units = 3 then gutter = ppm_ConvertUnits(3, 1, gutter)
  31.  
  32. page    = ppm_CurrentPage()
  33.  
  34. if page = 0 then
  35.     exit_msg("Create Page First")
  36.  
  37. margins = ppm_GetPageMargins(page)
  38. psize   = ppm_GetPageSize(page)
  39. pwidth  = word(psize, 1)
  40. pheight = word(psize, 2)
  41.  
  42. lmarg   = word(margins, 1)
  43. rmarg   = pwidth - word(margins, 2)
  44. tmarg   = word(margins, 3)
  45. bmarg   = pheight - word(margins, 4)
  46.  
  47. csep    = (rmarg - lmarg) / columns
  48. cwidth  = max((csep - gutter), gutter)
  49. rheight = (bmarg - tmarg)/ rows
  50. oldlc   = ppm_GetLineColor()
  51. call ppm_SetLineColor("Cyan")
  52. call ppm_SetLineWeight(0.01)
  53. call ppm_SetFillPattern(0)
  54.  
  55. call ppm_ShowStatus("Working")
  56.  
  57. call ppm_NewGroup()
  58. firstbox = ppm_DrawRect(lmarg, tmarg, lmarg + cwidth, tmarg + rheight)
  59. call ppm_AddToGroup(firstbox)
  60.  
  61. call ppm_SetBoxFrame(firstbox, 0)
  62. call ppm_SetBoxFrameData(firstbox, "cyan", "white", .01, 0, 0)
  63.  
  64. col = 2
  65. xoffset = csep
  66. yoffset = 0
  67.  
  68. do  i = 1 to rows
  69.  
  70.     do while col <= columns
  71.  
  72.         box =  ppm_CloneBox(firstbox, xoffset, yoffset)
  73.         xoffset = xoffset + csep
  74.         col = col + 1
  75.                 call ppm_AddToGroup(box)
  76.  
  77.     end
  78.  
  79.     yoffset = yoffset + rheight
  80.     xoffset = 0
  81.     col     = 1
  82.  
  83. end
  84.  
  85. call ppm_SetLineColor(oldlc)
  86. box =  ppm_MergeGroup()
  87. call ppm_BoxToBack(box)
  88. call ppm_SetBoxLock(box, 1)
  89. call ppm_SetBoxName(box, "Grid Lines")
  90.  
  91. exit_msg()
  92. break_d:
  93. break_e:
  94. break_c:
  95. halt:
  96.     call exit_msg("User aborted Genie!")
  97.  
  98. exit_msg: procedure expose units
  99. do
  100.    parse arg message
  101.  
  102.     call ppm_ClearStatus()
  103.  
  104.    if message ~= '' then
  105.        call ppm_Inform(1, message,)
  106.  
  107.    if units = 3 then call ppm_SetUnits(3)
  108.    call ppm_ClearStatus()
  109.    call ppm_AutoUpdate(1)
  110.    exit
  111. end
  112.